<template>
  <div class="person_homeView">
    <!-- <el-card v-if="!detailIsShow" class="top_nav" :shadow="shadowShow">
            <div class="top_nav_inner">
                <div class="top_nav_left">
                    <el-form label-width="100px" :inline="true" :size="optionButtonSize">
                        <el-form-item>
                            <el-input v-model="form.name" clearable placeholder="输入机构名称搜索" style="width:150px">
                            </el-input>
                        </el-form-item>
                        <el-form-item>
                            <el-select style="width: 150px;" v-model="form.organizedType" clearable placeholder="机构类型">
                                <el-option v-for="item in options" :key="item.value" :label="item.label"
                                    :value="item.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item>
                            <el-date-picker style="width:150px" value-format="yyyy-MM-dd" v-model="form.createDate"
                                type="date" :placeholder="$t('add.add122')">
                            </el-date-picker>
                        </el-form-item>

                        <el-form-item>
                            <el-button @click="getPatientList" type="primary" :size="optionButtonSize">{{ $t('add.add123')
                            }}</el-button>
                            <el-button @click="resetClick" plain :size="optionButtonSize">{{ $t('add.add124') }}</el-button>
                        </el-form-item>
                    </el-form>
                </div>
            </div>
        </el-card> -->
    <el-card :shadow="shadowShow" class="partner_inner">
      <el-row v-if="designListArr.length > 0">
        <div class="detail_header">
          <span class="title">{{ $t('caseorder.yulan.yulan81') }}</span>
        </div>
      </el-row>
      <div v-for="(item, index) in designListArr" :key="index" class="file">
        <div class="file_left">
          <img src="@/assets/img/order_file.png" alt="" />
          <div class="file_left_info">
            <span>{{ item.fileName }}</span>
            <span
              >{{ $t('caseorder.yulan.yulan82') }}：{{
                item.content || $t('caseorder.yulan.yulan83')
              }}</span
            >
          </div>
        </div>
        <div class="file_right">
          <!-- <img @click="fileChangeHandle" src="@/assets/img/file_changed.png" alt=""> -->
          <!-- <img src="@/assets/img/file_noChange.png" alt=""> -->
          <img
            src="@/assets/img/file_download.png"
            alt=""
            @click="download(item.fileUrl, item.fileName)"
          />
        </div>
      </div>
      <div v-if="designListArr.length == 0" class="nolist">{{ $t('add.add4') }}...</div>
      <div style="margin: 16px 0; float: right">
        <el-pagination
          background
          :current-page.sync="page"
          :page-sizes="[10, 20, 50, 100]"
          :page-size="limit"
          :total="total"
          layout="total, sizes, prev, pager, next, jumper"
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
        />
      </div>
    </el-card>
  </div>
</template>

<script>
export default {
  name: 'Home',
  components: {},
  data() {
    return {
      page: 1, // 默认第1页
      limit: 10, // 每页条数
      total: 0, // 总条数
      designListArr: [],
    };
  },
  created() {
    this.getList();
  },
  methods: {
    // 拿所有数据
    getList() {
      // orderId: "2",
      this.$http
        .post('/order/selectDesignList', { page: this.page, limit: this.limit })
        .then(({ data: res }) => {
          if (res.code !== 0) {
            return this.$message.error(res.msg);
          } else {
            this.designListArr = [];
            this.designListArr = res.data;
            this.total = res.data.total;
          }
        })
        .catch((err) => {
          console.log('err', err);
        });
    },
    download(url, name) {
      // this.downloadIamge(url, name)
      window.open(url);
      // window.location.href = url
    },
    // 搜索
    getPatientList() {
      this.getList();
    },
    handleSizeChange(val) {
      this.limit = val;
      this.getList();
    },
    handleCurrentChange(val) {
      this.page = val;
      this.getList();
    },
  },
};
</script>

<style lang="scss">
.detail_header {
  display: flex;
  align-items: center;
  margin-bottom: 12px;

  .title {
    font-size: 8px;
    font-weight: 500;
    line-height: 20px;
    color: #003e67;
  }
}

.nolist {
  width: 100%;
  height: 200px;
  line-height: 200px;
  text-align: center;
}

.file {
  margin-bottom: 10px;
  background-color: #f5f5f5;
  padding: 10px 30px 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;

  .file_left {
    display: flex;

    img {
      width: 22px;
      height: 30px;
    }

    .file_left_info {
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      margin-left: 12px;

      span {
        font-size: 8px;
        font-weight: 500;
        line-height: 11px;
        color: #333333;
      }
    }
  }

  .file_right {
    img {
      cursor: pointer;
      width: 16px;
      height: 16px;
    }

    img:nth-child(2) {
      margin-left: 20px;
    }
  }
}
</style>
